(function (a2dmah5) {
    a2dmah5.addExpandPage(0, function (get) {
        const Common = get('UtilsCommon', 'Common');

        return {
            expandInit() {
                this.saveEntityData2 = this.getProperty('saveEntityData2');
            },
            setRowDataProperties({ view, data }) {
                view.properties.forEach(p => {
                    if (p.name === 'Num') {
                        if (data.BalanceNum > 0) {
                            p.maxValue = data.BalanceNum;
                            p.minValue = 0;
                        }
                        else {
                            p.minValue = data.BalanceNum;
                            p.maxValue = 0;
                        }
                    }
                });
            },
            expandSetEntityData({ entityData }) {
                entityData.Status = 0;
                entityData.SaleRowVersion = this.entityData.SaleRowVersion;
                entityData.SaleOrderId = this.entityData.SaleOrderId;
                return entityData;
            },
            expandDataLoad({ data }) {
                this.entityData = data;
                if ((data.Status == 0 || data.Status == 1) && Common.isEquals(data.CreateUser, this.loginUser.UserId, true)) this.saveEntityData2.setIsVisible(true);
            },
        }
    });

})(window.a2dmah5);